<div id="userinfodiv"  >
</div>
<script>
  function getUserInfo() {
    let userinfo = localStorage.getItem("user");
    let user = JSON.parse(userinfo);
    if (user.Sex =="女"){
      document.getElementById("userinfodiv").style="background-color: red;"
    }else{
      document.getElementById("userinfodiv").style="background-color: yellow;"
    }
    document.getElementById("userinfodiv").innerText = user.Name + " 学号:" + user.Sn;
  }
  getUserInfo();
</script>
